import os
import sys

import pandas as pd

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
os.path.dirname(__file__)

from app.model_phl import util_log

current_path = os.path.dirname(__file__)


def get_loan_app_data():
    """
    获取贷款类App数据
    """
    try:
        # 读取LoanApp数据
        return pd.read_json(current_path + '/model/fk_qll_loanapp.json')
    except Exception as e:
        util_log.get_logger().error(e)
        return None


def get_risk_app_data():
    """
    获取高危贷款类App数据
    """
    try:
        # 读取RiskApp数据
        return pd.read_json(current_path + '/model/fk_qll_riskapp.json')
    except Exception as e:
        util_log.get_logger().error(e)
        return None


def get_confraud_info_data():
    """
    获取反欺诈通讯录数据
    """
    try:
        # 读取RiskApp数据
        return pd.read_json(current_path + '/model/fk_qll_confraudinfo.json')
    except Exception as e:
        return None


def get_major_fraud_data():
    """
    获取欺诈通讯录数据
    """
    try:
        # 读取RiskApp数据
        return pd.read_json(current_path + '/model/fk_qll_majorfraud.json')
    except Exception as e:
        util_log.get_logger().error(e)
        return None
